package com.ruoyi.develop.factory.factoryTestZnDetail.service.impl;

import java.util.List;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import com.ruoyi.develop.factory.factoryTestZnDetail.mapper.FactoryTestZnDetailMapper;
import com.ruoyi.develop.factory.factoryTestZnDetail.domain.FactoryTestZnDetail;
import com.ruoyi.develop.factory.factoryTestZnDetail.service.IFactoryTestZnDetailService;

/**
 * 出厂试验-镀锌质量-每次明细Service业务层处理
 *
 * @author lmm
 * @date 2025-06-07
 */
@Service
public class FactoryTestZnDetailServiceImpl implements IFactoryTestZnDetailService {
    @Resource
    private FactoryTestZnDetailMapper factoryTestZnDetailMapper;

    /**
     * 查询出厂试验-镀锌质量-每次明细
     *
     * @param id 出厂试验-镀锌质量-每次明细主键
     * @return 出厂试验-镀锌质量-每次明细
     */
    @Override
    public FactoryTestZnDetail selectById(String id) {
        return factoryTestZnDetailMapper.selectById(id);
    }

    /**
     * 查询出厂试验-镀锌质量-每次明细列表
     *
     * @param entity 出厂试验-镀锌质量-每次明细
     * @return 出厂试验-镀锌质量-每次明细
     */
    @Override
    public List<FactoryTestZnDetail> selectList(FactoryTestZnDetail entity) {
        return factoryTestZnDetailMapper.selectList(entity);
    }

    /**
     * 新增出厂试验-镀锌质量-每次明细
     *
     * @param entity 出厂试验-镀锌质量-每次明细
     * @return 结果
     */
    @Override
    public int insert(FactoryTestZnDetail entity) {
        if (StringUtils.isBlank(entity.getId())) {
            entity.setId(IdUtils.fastSimpleUUID());
        }
        entity.setCreateBy(SecurityUtils.getUsername());
        entity.setCreateTime(DateUtils.getNowDate());
        return factoryTestZnDetailMapper.insert(entity);
    }

    /**
     * 修改出厂试验-镀锌质量-每次明细
     *
     * @param entity 出厂试验-镀锌质量-每次明细
     * @return 结果
     */
    @Override
    public int update(FactoryTestZnDetail entity) {
        entity.setUpdateBy(SecurityUtils.getUsername());
        entity.setUpdateTime(DateUtils.getNowDate());
        return factoryTestZnDetailMapper.update(entity);
    }

    /**
     * 批量删除出厂试验-镀锌质量-每次明细
     *
     * @param ids 需要删除的出厂试验-镀锌质量-每次明细主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return factoryTestZnDetailMapper.deleteByIds(ids);
    }

    /**
     * 删除出厂试验-镀锌质量-每次明细信息
     *
     * @param id 出厂试验-镀锌质量-每次明细主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return factoryTestZnDetailMapper.deleteById(id);
    }

    @Override
    public void deleteByTestId(String testId) {
        factoryTestZnDetailMapper.deleteByTestId(testId);
    }


}
